<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
    <meta content=always name=referrer>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/renzheng.css">
    <script src="__STATIC__/js/jquery-1.8.2.js"></script>
    <title>个人认证</title>
    <script>
        $(function(){
            $(".tablist li").click(
                    function(){
                        var a=$(".tablist li").index(this);
                        $(this).addClass("cur");
                        $(this).siblings().removeClass("cur");
                        $(".tabcon>div").eq(a).css({display:"block"}).children('.difference').val('1');
                        $(".tabcon>div").eq(a).siblings().css({display:"none"}).children('.difference').val('0');
                        upload_img();
                    }

            )
        })
    </script>
    <style>
        .fileInputContainer{
            position:relative;
            width: 100%;
            height: 160px;
        }
        .fileInput{
            width:100%;
            height:160px;
            position:absolute;
            right:0;
            top:0;
            opacity: 0;
            filter:alpha(opacity=0);
            cursor:pointer;
        }
        #wall_0{background:url(__STATIC__/img/bg2.png);background-size: 100% 100%;}
        #wall_1{background:url(__STATIC__/img/bg3.png);background-size: 100% 100%;}
        #wall_2{background:url(__STATIC__/img/bg4.png);background-size: 100% 100%;}
    </style>
    {include file="public/href" /}
</head>
<body>
<div class="wrap-gr">
    <div class="header">
        <p>认证</p>
        <img src="__STATIC__/img/back.png" onclick=window.location.href="{:url('mobile/shop_auth/login')}"; class="back">
    </div>
    <div class="center">
        <div class="title">
            <ul>
                <li class="cir"></li>
                <li>认证身份</li>
                <li class="cir"></li>
            </ul>
        </div>
        <div class="tablist">
            <ul>
                <li class="cur"><p><span><span></span></span><span><a href="javascript:void(0);">个人</a></span></p></li>
                <li><p><span><span></span></span><span><a href="javascript:void(0);">商家</a></span></p></li>
            </ul>
        </div>
        <div class="title">
            <ul>
                <li class="cir"></li>
                <li>填写信息</li>
                <li class="cir"></li>
            </ul>
        </div>
        <form method="post" action="" id="form" enctype="multipart/form-data">
        <div class="tabcon">
            <div class="cur">
                <input class="difference" type="hidden" name="person" value="1"/>
                <input class="text" type="text" name="person_name" placeholder="真实姓名" >
                <input class="text" type="text" name="person_number_id" placeholder="身份证号" >
                <ul>
                    <li style="margin-left: 25%;">
                        <div class="fileInputContainer" id="wall_0" >
                        <input type="file" class="fileInput" name="file[]" accept="image/*" id="imgInp_0" />
                        </div>
                        <span>身份证正面</span>
                    </li>
                </ul>
                <input class="submit" type="button" onclick="putData()" value="提交申请">
                <div>
                    <input type="checkbox" name="deal" onclick="checkAll(this.checked)" value="1">
                    <label>已阅读并同意<span onclick="window.location.href='dealContent'">平台管理协议</span></label>
                </div>
            </div>
            <div>
                <input class="difference" type="hidden"  name="shop" value="0"/>
                <input class="text" type="text" name="shop_name" placeholder="法人姓名" >
                <input class="text" type="text" name="shop_number_id" placeholder="法人身份证号">
                <ul>
                    <li>
                        <div class="fileInputContainer" id="wall_1">
                        <input type="file" class="fileInput" name="file[]" accept="image/*" id="imgInp_1" />
                        </div>
                        <span>法人身份证正面</span>
                    </li>
                    <li>
                        <div class="fileInputContainer" id="wall_2">
                        <input type="file" class="fileInput" name="file[]" accept="image/*" id="imgInp_2" />
                        </div>
                        <span>营业执照</span>
                    </li>
                </ul>
                <input class="submit" type="button" onclick="putData()" value="提交申请">
                <div>
                    <input type="checkbox" name="deal" onclick="checkAll(this.checked)"  value="1">
                    <label>已阅读并同意<span onclick="window.location.href='deal_content'">平台管理协议</span></label>
                </div>
            </div>
        </div>
        </form>
    </div>


</div>
{include file="public/src"  /}
<script>
    //协议同步选中
    function checkAll(val){
        $("[name='deal']").prop('checked',val);
    }
    function upload_img(){
        if ($("[name='person']").val() == 1){
            $('#imgInp_0').attr('name','file[]');
            $('#imgInp_1').attr('name','');
            $('#imgInp_2').attr('name','');
        }else{
            $('#imgInp_0').attr('name','');
            $('#imgInp_1').attr('name','file[]');
            $('#imgInp_2').attr('name','file[]');
        }
    }
    //提交表单数据
    function putData()
    {
        if ($("[name='person']").val() == 1){
            if ($('#imgInp_0').val() == ''){
                layer.open({content:'请上传身份证正面',skin:'msg',time:2});
                return false;
            }
        }else{
            if ($('#imgInp_1').val() == ''){
                layer.open({content:'请上传法人身份证正面',skin:'msg',time:2});
                return false;
            }
            if ($('#imgInp_2').val() == ''){
                layer.open({content:'请上传营业执照',skin:'msg',time:2});
                return false;
            }
        }
        $('#form').ajaxSubmit({
            url:"{:url('mobile/shop_auth/index')}",
            type:'post',
            dataType:'json',
            enctype: 'multipart/form-data',
            success:function (t) {
                layer.open({content:t.message,skin:'msg',time:2});
                if (t.code == 200) {
                    setTimeout(function () {
                        window.location.href = "{:url('mobile/shop_auth/create_wait')}";   //跳转到等待认证页面
                    },2000)
                }
            },
            error:function () {
                layer.open({content:'网络繁忙,请重试',skin:'msg',time:2});
            }
        });
        return false;
    }
</script>
</body>
</html>